package com.znxs.api_management_c.service;

import com.znxs.api_management_c.common.BaseResponse;
import com.znxs.api_management_c.model.entity.UserInfo;
import com.baomidou.mybatisplus.extension.service.IService;

import javax.servlet.http.HttpServletRequest;

/**
* @author znxs
* @description 针对表【user_info】的数据库操作Service
* @createDate 2024-07-03 14:28:00
*/
public interface UserInfoService extends IService<UserInfo> {

    /**
     * 用户注册
     * @param username 用户账户
     * @param password 设置密码
     * @param checkPassword 校验密码
     * @return 注册用户id
     */
    long userRegister(String username,String password,String checkPassword);

    /**
     * 用户登录
     * @param request http请求
     * @param username 用户账户
     * @param password 账户密码
     * @return 登录用户对象
     */
    UserInfo userLogin(HttpServletRequest request,String username,String password);

    /**
     * 获取用户脱敏信息
     * @param oldUserInfo 原始用户信息
     * @return 脱敏后用户信息
     */
    UserInfo getSafetyUser(UserInfo oldUserInfo);

    /**
     * 查看用户是否登录
     * @param request http请求
     * @return
     */
    boolean isLogin(HttpServletRequest request);

    /**
     * 退出登录
     * @param request http请求
     * @return
     */
    boolean exitLogin(HttpServletRequest request);

}
